.286

arg1 equ 4

STACK segment para stack

  db 6 dup(?)

STACK ends

DATA segment para public
  str1 db "Hello, World!",0Dh,0Ah, '$'
DATA ends

CODE segment para public

assume cs:CODE,ds:DATA,ss:STACK

;void putchar(int c)
putchar:
  push bp
  mov bp, sp
  
  mov dx, word ptr [bp + arg1]
  mov ah, 02h
  int 21h


  mov sp, bp
  pop bp
  ret

;void exit(int code)
_exit:
  push bp
  mov bp, sp

  mov ax, word ptr [bp + arg1]

  mov ah,4ch
  int 21h

  mov sp, bp
  pop bp
  ret


start:

  mov ax, DATA
  mov ds, ax
  mov ax, STACK
  mov ss, ax

  mov dx,31h
  push dx
  call putchar

  mov dx,0
  push dx
  call _exit

CODE ends
end start
